﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace VisifireTest
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            this.Loaded += MainWindow_Loaded;
        }

        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            _ctlChart.AnimationEnabled = true;
            _ctlChart.ZoomingEnabled = false;

            Visifire.Charts.DataSeries dataSeries = new Visifire.Charts.DataSeries();
            _ctlChart.ScrollingEnabled = false;
            //dataSeries.Background = new SolidColorBrush(Colors.Green);
            //_ctlChart.View3D = true;
            _ctlChart.ShadowEnabled = false;
            _ctlChart.LightingEnabled = false;
            _ctlChart.View3D = false;
            _ctlChart.DataPointWidth = 0;// = false;   

            dataSeries.RenderAs = Visifire.Charts.RenderAs.Area;
            dataSeries.Bevel = false;
            dataSeries.Color = new SolidColorBrush(Colors.Yellow);
            dataSeries.LightingEnabled = false;
            dataSeries.ShadowEnabled = false;
            dataSeries.BorderColor = new SolidColorBrush(Colors.Red);
            dataSeries.BorderBrush = new SolidColorBrush(Colors.Red);
            dataSeries.BorderThickness = new Thickness(3, 0, 1, 0);
            dataSeries.LineStyle = Visifire.Charts.LineStyles.Solid;
            dataSeries.LineFill = new SolidColorBrush(Colors.Red);
            dataSeries.LineCap = PenLineCap.Round;
            dataSeries.LineThickness = 3;


            for (int index = 0; index < 10; index++)
            {
                Visifire.Charts.DataPoint point = new Visifire.Charts.DataPoint();
                //point.LabelText = "I" + index.ToString();
                //point.LabelEnabled = false;
                point.YValue =new Random().Next(index, 30);
                point.LabelLineColor = new SolidColorBrush(Colors.Red);
                point.LabelLineThickness = 1;
                point.BorderColor = new SolidColorBrush(Colors.Red);
                point.BorderThickness = new Thickness(1);
                point.StickColor = new SolidColorBrush(Colors.Red);
                //point.LightingEnabled = false;
                //point.BorderBrush = new SolidColorBrush(Colors.Red);
                //point.BorderThickness = new Thickness(3);
                //point.Background = new SolidColorBrush(Colors.Blue);
                dataSeries.DataPoints.Add(point);
            }
            _ctlChart.Series.Add(dataSeries);

            //_ctlChart.PlotArea = new Visifire.Charts.PlotArea();
            ////_ctlChart.PlotArea.Bevel = true;
            ////_ctlChart.PlotArea.BorderThickness = new Thickness(1);
            ////_ctlChart.PlotArea.BorderColor = new SolidColorBrush(Colors.Green);//PlotAreaBorderColor == null ? null : PlotAreaBorderColor;
            //_ctlChart.PlotArea.Background = null;// new SolidColorBrush(Colors.Green); ;
            ////_ctlChart.PlotArea.LightingEnabled = false;// PlotAreaLightingEnable;
            //_ctlChart.PlotArea.ShadowEnabled = true;// PlotAreaShadowEnabled;

        }

        private void TestPie()
        {
            _ctlChart.AnimationEnabled = true;

            Visifire.Charts.DataSeries dataSeries = new Visifire.Charts.DataSeries();
            //dataSeries.Background = new SolidColorBrush(Colors.Green);
            //_ctlChart.View3D = true;
            _ctlChart.ShadowEnabled = false;
            _ctlChart.LightingEnabled = false;
            _ctlChart.View3D = false;

            dataSeries.RenderAs = Visifire.Charts.RenderAs.Pie;
            dataSeries.Bevel = false;
            dataSeries.LightingEnabled = false;
            dataSeries.ShadowEnabled = false;
            for (int index = 0; index < 5; index++)
            {
                Visifire.Charts.DataPoint point = new Visifire.Charts.DataPoint();
                point.LabelText = "I" + index.ToString();
                point.LabelEnabled = false;
                point.YValue = index * 20 + 10;
                point.LightingEnabled = false;
                point.BorderBrush = new SolidColorBrush(Colors.Red);
                point.BorderThickness = new Thickness(3);
                point.Background = new SolidColorBrush(Colors.Blue);
                dataSeries.DataPoints.Add(point);
            }
            _ctlChart.Series.Add(dataSeries);

            //_ctlChart.PlotArea = new Visifire.Charts.PlotArea();
            ////_ctlChart.PlotArea.Bevel = true;
            ////_ctlChart.PlotArea.BorderThickness = new Thickness(1);
            ////_ctlChart.PlotArea.BorderColor = new SolidColorBrush(Colors.Green);//PlotAreaBorderColor == null ? null : PlotAreaBorderColor;
            //_ctlChart.PlotArea.Background = null;// new SolidColorBrush(Colors.Green); ;
            ////_ctlChart.PlotArea.LightingEnabled = false;// PlotAreaLightingEnable;
            //_ctlChart.PlotArea.ShadowEnabled = true;// PlotAreaShadowEnabled;

        }

        protected override void OnMouseDoubleClick(MouseButtonEventArgs e)
        {
            base.OnMouseDoubleClick(e);
        }
    }
}
